﻿using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;

namespace Lisphi.Lab.ProfWFChap06
{
	public partial class MyActivity: SequenceActivity
	{
        public static DependencyProperty ActivityName1Property = System.Workflow.ComponentModel.DependencyProperty.Register("ActivityName1", typeof(string), typeof(MyActivity));

		public MyActivity()
		{
			InitializeComponent();
		}

        [Description("depedancy property - ActivityName1")]
        [Category("Dependency Properties")]
        [Browsable(true)]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public string ActivityName1
        {
            get
            {
                return ((string)(base.GetValue(MyActivity.ActivityName1Property)));
            }
            set
            {
                base.SetValue(MyActivity.ActivityName1Property, value);
            }
        }

        [Description("non-depedancy property - ActivityName2")]
        [Browsable(true)]
        public string ActivityName2 { get; set; }

        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
            Console.WriteLine(string.Format("MyActivity executed! ActivityName1:[{0}] ActivityName2:[{1}]", this.ActivityName1, this.ActivityName2));
            return base.Execute(executionContext);
        }
	}

}
